package org.jetlinks.community.messaging.rabbitmq.command.admin;

import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpMethod;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;

@Getter
@Setter
public class GetUsers extends AdminCommand<Flux<RabbitMQUser>> {

    public static GetUsers of(){
        return new GetUsers();
    }

    @Override
    public String api() {
        return "/api/users";
    }

    @Override
    public HttpMethod method() {
        return HttpMethod.GET;
    }

    @Override
    public Flux<RabbitMQUser> convert(WebClient.ResponseSpec responseSpec) {
        return responseSpec.bodyToFlux(RabbitMQUser.class);
    }
}
